#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;

const int N = 15, INF = 0x3f3f3f3f;

int n, m;
char a[N][N];

void solve()
{

    while (cin >> n >> m) {
        int flag = 1;
        int x1 = INF, y1 = INF, x2 = 0, y2 = 0, sum = 0;
        for (int i = 1;i <= n;i++)
            for (int j = 1;j <= m;j++) {
                cin >> a[i][j];
                if (a[i][j] == '1') {
                    sum++;
                    x1 = min(x1, i);
                    y1 = min(y1, j);
                    x2 = max(x2, i);
                    y2 = max(y2, j);
                }
            }

        if (sum == 0) { flag = 0; }

        for (int i = x1;i <= x2 && flag;i++)
            for (int j = y1;j <= y2 && flag;j++)
                if (a[i][j] != '1')  flag = 0;

        if (flag) cout << "Yes\n";
        else cout << "No\n";
    }
}

signed main()
{
    //ios::sync_with_stdio(0);
    //cin.tie(0);cout.tie(0);
#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
    std::istringstream in(R"()");
    std::cin.rdbuf(in.rdbuf());
#endif
    int T = 1;
    //cin>>T;
    for (int i = 1;i <= T;i++) {
        solve();
    }
}